package com.whd.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author whd
 * @date 2023/08/02 17:27:07
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultVo {
    private Integer code;
    private String msg;
    private Object data;

    public static ResultVo success() {
        return success("操作成功");
    }

    public static ResultVo success(String msg) {
        return success(msg, null);
    }

    public static ResultVo success(Object data) {
        return success("操作成功", data);
    }

    public static ResultVo success(String msg, Object data) {
        return new ResultVo(200, msg, data);
    }

    public static ResultVo failure() {
        return failure("操作失败");
    }

    public static ResultVo failure(String msg) {
        return failure(msg, null);
    }

    public static ResultVo failure(Object data) {
        return failure("操作失败", data);
    }

    public static ResultVo failure(String msg, Object data) {
        return new ResultVo(500, msg, data);
    }
}
